
<!DOCTYPE HTML>
<html lang="Chinese" >
    <head>
        <title>互斥量 · freeRTOS中文文档</title>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.0">
        <meta name="author" content="tangguocheng">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prismx/prism.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="递归互斥量.html" />
    
    
    <link rel="prev" href="计数信号量.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.xn--4gqa63c686ta68iba.ren/" target="_blank" class="custom-link">博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    关于
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../简介/freeRTOS介绍.html">
            
                <a href="../../简介/freeRTOS介绍.html">
            
                    
                    简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../简介/编码规则和风格.html">
            
                <a href="../../简介/编码规则和风格.html">
            
                    
                    编码规则和风格
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../简介/许可.html">
            
                <a href="../../简介/许可.html">
            
                    
                    许可
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../简介/快速开始指南.html">
            
                <a href="../../简介/快速开始指南.html">
            
                    
                    快速开始指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../readme.html">
            
                <a href="../readme.html">
            
                    
                    入门
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../任务和协程/readme.html">
            
                <a href="../任务和协程/readme.html">
            
                    
                    任务和协程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../任务和协程/任务.html">
            
                <a href="../任务和协程/任务.html">
            
                    
                    任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../任务和协程/协程.html">
            
                <a href="../任务和协程/协程.html">
            
                    
                    协程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                    通信机制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="队列.html">
            
                <a href="队列.html">
            
                    
                    队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="二值信号量.html">
            
                <a href="二值信号量.html">
            
                    
                    二值信号量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.3" data-path="计数信号量.html">
            
                <a href="计数信号量.html">
            
                    
                    计数信号量
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.2.4" data-path="互斥量.html">
            
                <a href="互斥量.html">
            
                    
                    互斥量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.5" data-path="递归互斥量.html">
            
                <a href="递归互斥量.html">
            
                    
                    递归互斥量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.6" data-path="任务通知.html">
            
                <a href="任务通知.html">
            
                    
                    任务通知
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../事件组/事件组.html">
            
                <a href="../事件组/事件组.html">
            
                    
                    事件组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../软件定时器/软件定时器.html">
            
                <a href="../软件定时器/软件定时器.html">
            
                    
                    软件定时器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../进阶/readme.md">
            
                <span>
            
                    
                    进阶
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../进阶/源代码组织结构/源代码组织结构.html">
            
                <a href="../../进阶/源代码组织结构/源代码组织结构.html">
            
                    
                    源代码组织结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../进阶/高级/配置文件.html">
            
                <a href="../../进阶/高级/配置文件.html">
            
                    
                    配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../进阶/高级/跟踪特性.html">
            
                <a href="../../进阶/高级/跟踪特性.html">
            
                    
                    跟踪特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../进阶/高级/低功耗支持.html">
            
                <a href="../../进阶/高级/低功耗支持.html">
            
                    
                    低功耗支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../进阶/高级/运行时间统计.html">
            
                <a href="../../进阶/高级/运行时间统计.html">
            
                    
                    运行时间统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../../进阶/高级/队列集合.html">
            
                <a href="../../进阶/高级/队列集合.html">
            
                    
                    队列集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../../进阶/高级/中断延迟.html">
            
                <a href="../../进阶/高级/中断延迟.html">
            
                    
                    中断延迟
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../../进阶/高级/静态分配与动态分配.html">
            
                <a href="../../进阶/高级/静态分配与动态分配.html">
            
                    
                    静态和动态内存分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../../进阶/高级/内存管理.html">
            
                <a href="../../进阶/高级/内存管理.html">
            
                    
                    内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../../进阶/高级/栈溢出检测.html">
            
                <a href="../../进阶/高级/栈溢出检测.html">
            
                    
                    栈溢出检测
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../../进阶/高级/钩子函数.html">
            
                <a href="../../进阶/高级/钩子函数.html">
            
                    
                    钩子函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../../进阶/高级/线程本地存储.html">
            
                <a href="../../进阶/高级/线程本地存储.html">
            
                    
                    线程本地存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../../进阶/高级/移植指南.html">
            
                <a href="../../进阶/高级/移植指南.html">
            
                    
                    移植指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../../进阶/高级">
            
                <span>
            
                    
                    在windows上模拟
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >互斥量</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
                                <section class="normal markdown-section">
                                
                                <p>&#x4E92;&#x65A5;&#x91CF;(<code>Mutexes</code>)&#x53EF;&#x4EE5;&#x6982;&#x62EC;&#x6210;&#x62E5;&#x6709;&#x4F18;&#x5148;&#x7EA7;&#x7EE7;&#x627F;&#x5C5E;&#x6027;&#x7684;&#x4E8C;&#x503C;&#x4FE1;&#x53F7;&#x91CF;(&#x4F60;&#x770B;&#xFF0C;&#x4FE1;&#x53F7;&#x91CF;&#x3001;&#x4E92;&#x65A5;&#x3001;&#x961F;&#x5217;&#x5176;&#x5B9E;&#x90FD;&#x662F;&#x7C7B;&#x4F3C;&#x7684;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x5404;&#x81EA;&#x7684;&#x7279;&#x4FD7;&#x5C5E;&#x6027;&#x4F7F;&#x5F97;&#x5728;&#x67D0;&#x4E9B;&#x5E94;&#x7528;&#x573A;&#x5408;&#x66F4;&#x52A0;&#x5408;&#x9002;&#x800C;&#x5DF2;)&#x3002;</p><p><code>Mutexes</code>(&apos;MUT&apos;ual &apos;EX&apos;clusion)&#x66F4;&#x9002;&#x5408;&#x5B8C;&#x6210;&#x4E92;&#x65A5;&#xFF0C;&#x4E8C;&#x503C;&#x4FE1;&#x53F7;&#x91CF;&#x66F4;&#x9002;&#x5408;&#x5B8C;&#x6210;&#x540C;&#x6B65;&#x3002;</p><p>&#x5728;&#x5F88;&#x591A;&#x5D4C;&#x5165;&#x5F0F;&#x5E94;&#x7528;&#x4E2D;&#xFF0C;&#x67D0;&#x4E2A;&#x5916;&#x8BBE;&#x901A;&#x5E38;&#x60C5;&#x51B5;&#x4E0B;&#x662F;&#x9700;&#x8981;&#x72EC;&#x5360;&#x7684;&#x53BB;&#x4F7F;&#x7528;&#x7684;&#xFF0C;&#x6BD4;&#x5982;&#x4E00;&#x4E2A;&#x4E32;&#x53E3;&#xFF0C;&#x5982;&#x679C;A&#x4EFB;&#x52A1;&#x9700;&#x8981;&#x53D1;&#x9001;&quot;hello&quot;,B&#x4EFB;&#x52A1;&#x53D1;&#x9001;&quot;world&quot;,&#x5982;&#x679C;&#x4E0D;&#x53BB;&#x52A0;&#x4EE5;&#x63A7;&#x5236;&#xFF0C;&#x4E24;&#x4E2A;&#x4EFB;&#x52A1;&#x90FD;&#x80FD;&#x540C;&#x65F6;&#x5F97;&#x5230;&#x8FD9;&#x4E2A;&#x4E32;&#x53E3;&#x7684;&#x4F7F;&#x7528;&#x6743;&#xFF0C;&#x56E0;&#x4E3A;&#x5185;&#x6838;&#x8C03;&#x5EA6;&#x7684;&#x7F18;&#x6545;&#xFF0C;&#x6700;&#x7EC8;&#x53D1;&#x9001;&#x51FA;&#x6765;&#x7684;&#x53EF;&#x80FD;&#x662F;&quot;heworllold&quot;&#x3002;&#x8FD9;&#x5C06;&#x6BEB;&#x65E0;&#x610F;&#x4E49;&#x3002;&#x4E92;&#x65A5;&#x91CF;&#x5373;&#x53EF;&#x4EE5;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x4EFB;&#x52A1;&#x5728;&#x4F7F;&#x7528;&#x67D0;&#x4E2A;&#x8D44;&#x6E90;&#x65F6;&#xFF0C;&#x5FC5;&#x987B;&#x5148;&#x83B7;&#x5F97;&#x4F7F;&#x7528;&#x6743;&#x9650;&#xFF0C;&#x6B64;&#x65F6;&#x5176;&#x4ED6;&#x4EFB;&#x52A1;&#x56E0;&#x4E3A;&#x65E0;&#x6CD5;&#x83B7;&#x5F97;&#x8FD9;&#x4E2A;&#x8D44;&#x6E90;&#x7684;&#x4F7F;&#x7528;&#x6743;&#x9650;&#x800C;&#x963B;&#x585E;&#xFF0C;&#x7B49;&#x5F85;&#x4EFB;&#x52A1;&#x4F7F;&#x7528;&#x5B8C;&#x6210;&#xFF0C;&#x91CA;&#x653E;&#x8D44;&#x6E90;&#x4F7F;&#x5F97;&#x8D44;&#x6E90;&#x91CD;&#x65B0;&#x53D8;&#x4E3A;&#x53EF;&#x7528;&#xFF0C;&#x6B64;&#x65F6;&#x7B49;&#x5F85;&#x8FD9;&#x4E2A;&#x8D44;&#x6E90;&#x7684;&#x5176;&#x4ED6;&#x4EFB;&#x52A1;&#x83B7;&#x5F97;&#x4F7F;&#x7528;&#x6743;&#x3002;</p><p>&#x4EE5;&#x4E0A;&#xFF0C;&#x5176;&#x5B9E;&#x4E5F;&#x5C31;&#x662F;&#x4E92;&#x65A5;&#x91CF;&#x7684;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#x3002;&#x4E92;&#x65A5;&#x91CF;&#x4E8E;&#x4FE1;&#x53F7;&#x91CF;&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x7684;API&#xFF0C;&#x56E0;&#x6B64;&#x4E5F;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x8D85;&#x65F6;&#x65F6;&#x95F4;&#x3002;&#x4E0E;&#x4E8C;&#x503C;&#x4FE1;&#x53F7;&#x91CF;&#x4E0D;&#x540C;&#x7684;&#x662F;&#xFF0C;&#x4E92;&#x65A5;&#x91CF;&#x5177;&#x6709;&#x4F18;&#x5148;&#x7EA7;&#x7EE7;&#x627F;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x8FD9;&#x662F;&#x4E3A;&#x4E86;&#x9632;&#x6B62;&#x4F18;&#x5148;&#x7EA7;&#x53CD;&#x8F6C;&#x800C;&#x8BBE;&#x8BA1;&#x7684;&#x3002;&#x5F53;&#x4E00;&#x4E2A;&#x9AD8;&#x4F18;&#x5148;&#x7EA7;&#x7684;&#x4EFB;&#x52A1;&#x5728;&#x7B49;&#x5F85;&#x4E00;&#x4E2A;&#x8D44;&#x6E90;&#x800C;&#x88AB;&#x963B;&#x585E;&#x65F6;&#xFF0C;&#x5F53;&#x524D;&#x83B7;&#x5F97;&#x8BE5;&#x8D44;&#x6E90;&#x7684;&#x4F4E;&#x4F18;&#x5148;&#x7EA7;&#x4EFB;&#x52A1;&#x5C06;&#x77ED;&#x6682;&#x7EE7;&#x627F;&#x9AD8;&#x4F18;&#x5148;&#x7EA7;&#x4EFB;&#x52A1;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x4E00;&#x4E2A;&#x786C;&#x5B9E;&#x65F6;&#x7CFB;&#x7EDF;&#x5728;&#x8BBE;&#x8BA1;&#x7684;&#x65F6;&#x5019;&#x5C31;&#x5E94;&#x8BE5;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x3002;</p><p>&#x4E92;&#x65A5;&#x91CF;&#x4E0D;&#x80FD;&#x5728;&#x4E2D;&#x65AD;&#x4E2D;&#x4F7F;&#x7528;&#xFF1A;</p><ul><li>&#x4E92;&#x65A5;&#x91CF;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x7EE7;&#x627F;&#x5C5E;&#x6027;&#x610F;&#x5473;&#x7740;&#x53EA;&#x80FD;&#x5728;&#x4EFB;&#x52A1;&#x95F4;&#x4F7F;&#x7528;
</li>
<li>&#x4E2D;&#x65AD;&#x5728;&#x7B49;&#x5F85;&#x4E00;&#x4E2A;&#x4E92;&#x65A5;&#x91CF;&#x4FDD;&#x62A4;&#x7684;&#x8D44;&#x6E90;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E0D;&#x80FD;&#x963B;&#x585E;
</li></ul>
<p>&#x4E0B;&#x56FE;&#x662F;&#xFF0C;&#x4E92;&#x65A5;&#x91CF;&#x7684;&#x4F7F;&#x7528;&#x56FE;&#xFF1A;</p><p><img alt="&#x4E92;&#x65A5;&#x91CF;" src="http://www.freertos.org/mutexes.gif"></p>
                                
                                </section>
                            
                        </div>
                    </div>
                
            </div>

            
                
                <a href="计数信号量.html" class="navigation navigation-prev " aria-label="Previous page: 计数信号量">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="递归互斥量.html" class="navigation navigation-next " aria-label="Next page: 递归互斥量">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"互斥量","level":"1.3.2.4","depth":3,"next":{"title":"递归互斥量","level":"1.3.2.5","depth":3,"path":"入门/通信机制/递归互斥量.md","ref":"入门/通信机制/递归互斥量.md","articles":[]},"previous":{"title":"计数信号量","level":"1.3.2.3","depth":3,"path":"入门/通信机制/计数信号量.md","ref":"入门/通信机制/计数信号量.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prismx","-highlight","-search","duoshuo","ga","theme-comscore"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"ga":{"configuration":"auto","token":"UA-80700049-1"},"duoshuo":{"short_name":"tangguocheng","theme":"default"},"prismx":{"css":["prismjs/themes/prism-tomorrow.css"]},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-comscore":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"mobi":{"fontSize":12,"footerTemplate":null,"headerTemplate":null,"margin":{"bottom":36,"left":62,"right":62,"top":36},"pageNumbers":false,"paperSize":"a4"},"theme":"default","author":"tangguocheng","pdf":{"pageBreaksBefore":"/","headerTemplate":null,"paperSize":"a4","margin":{"right":62,"left":62,"top":36,"bottom":36},"fontSize":12,"fontFamily":"Arial","footerTemplate":null,"chapterMark":"pagebreak","pageNumbers":false},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"freeRTOS中文文档","language":"Chinese","links":{"sidebar":{"博客":"http://www.xn--4gqa63c686ta68iba.ren/"}},"gitbook":"*","description":"freeRTOS中文文档","extension":null},"file":{"path":"入门/通信机制/互斥量.md","mtime":"2016-08-29T00:47:32.771Z","type":"markdown"},"gitbook":{"version":"3.2.0","time":"2016-09-18T09:07:11.640Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-duoshuo/duoshuo.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ga/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

